package big.ketech.process.controller;

import big.ketech.process.dataobject.TStudent;
import big.ketech.process.service.IStudentService;
import big.ketech.utils.MyExcelExportUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * @FileName: PoiExportController
 * @Author Yep
 * @create 2020-11-30
 * @Description:
 */

@Controller
@RequestMapping("/export")
@Slf4j
public class PoiExportController {

    @Autowired(required = false)
    private IStudentService studentService;

    @RequestMapping("/test")
    public void exportStudent(HttpServletResponse response) {
        log.info("测试导出");
        try {
            List<TStudent> sutdentList = studentService.queryAllStudent();
            MyExcelExportUtil.exportExcel(sutdentList, TStudent.class,"学生基本信息","新生入学信息",response);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

